package com.ggs.rg.ybjb.pojomodule.pojo;


import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@TableName("t_goods")
public class Goods implements Serializable {
    @TableId(value = "gid",type = IdType.AUTO)
    private int gid;//商品ID
    private String name;//商品名字
    private String gDesc;//商品详情
    private String image;//商品图片
    private Timestamp startTime;//上架时间（优惠功能）
    private Timestamp endTime;//抢购商品截止时间（优惠功能)
    private int status;//记录商品的状态,2:截止的抢购商品状态1:正在进行中的抢购商品,0:非抢购商品
    private String type;//商品的类型，如数码，服装，食品
    @TableField(value = "create_time",fill = FieldFill.INSERT)
    private Date createTime;//数据生成时自动创建时自动
    @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;//数据生成时自动生成，修改时自动更新
    @Version
    private Integer version;//乐观锁
    @TableField(exist = false)
    private List<Mater> maters;
    @TableField(exist = false)
    private List<TComment> tComments;
    //逻辑删除
    @TableLogic
    private Byte deletes;
    //对应一个参数
    @TableField(exist = false)
    private Mater mater;

    public Goods(String name, String gDesc, String image, int status, String type) {
        this.name = name;
        this.gDesc = gDesc;
        this.image = image;
        this.status = status;
        this.type = type;
    }

    public Goods(String name,int status, String type) {
        this.name = name;
        this.status = status;
        this.type = type;
    }

    public Goods(int gid, String name, String gDesc, String image, int status, String type) {
        this.gid = gid;
        this.name = name;
        this.gDesc = gDesc;
        this.image = image;
        this.status = status;
        this.type = type;
    }
}
